﻿using System;
using System.Collections.Generic;
using System.Text;
using EmbeddedSharp.Core.Function;

namespace EmbeddedSharp.Core.Function.Trigonometry {
    public class AcoshNode : FuncNode {

        public AcoshNode()
            : base() {
            base.Value = "acosh";
        }

        public override FuncNode GetReversedFunction(int index) {
            return new CoshNode();
        }

        public override object Evaluate()
        {
            if (Parameters.Count < 1)
            {
                throw new ArgumentException(
                    "usage: acosh(number)");
            }

            double result = Convert.ToDouble(Parameters[0].Evaluate());

            return SpecialFunction.acosh(result).ToString();
        }
    }
}
